﻿using System.Data;

namespace DAL
{
    public static class DalCustomerCareDetail
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable GetCustomerCareDetailDetailEdit(int ID_CustomerCare, int Flag)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_CustomerCare", ID_CustomerCare);
            Cls.AddParameter("@Flag", Flag);
            return Cls.GetData("sp_CustomerCareDetail_Get");
        }
        public static DataTable GetCustomerCareDetailDetailTemp(int Flag)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Flag", Flag);
            return Cls.GetData("sp_CustomerCareDetail_Get_Temp");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtCustomerCareDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_CustomerCare", obj.ID_CustomerCare);
            Cls.AddParameter("@Customer_ID", obj.Customer_ID);
            Cls.AddParameter("@Subjects", obj.Subjects);
            Cls.AddParameter("@Content", obj.Content);
            Cls.AddParameter("@Users_Id", obj.Users_Id);
            Cls.AddParameter("@Flag", obj.Flag);
            return Cls.ExecuteNonQuery("sp_CustomerCareDetail_Insert");
        }
        public static bool Update(EtCustomerCareDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_Detail", obj.ID_Detail);
            Cls.AddParameter("@Subjects", obj.Subjects);
            Cls.AddParameter("@Content", obj.Content);
            return Cls.ExecuteNonQuery("sp_CustomerCareDetail_Update");
        }
        public static bool Delete(EtCustomerCareDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_Detail", obj.ID_Detail);
            return Cls.ExecuteNonQuery("sp_CustomerCareDetail_Delete");
        }
        public static bool DeleteTemp(EtCustomerCareDetail obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Users_Id", obj.Users_Id);
            return Cls.ExecuteNonQuery("sp_CustomerCareDetail_Delete_Temp");
        }
        #endregion
    }
    public class EtCustomerCareDetail
    {
        public int ID_Detail { get; set; }
        public int ? ID_CustomerCare { get; set; }
        public int ? Customer_ID { get; set; }
        public string Subjects { get; set; }
        public string Content { get; set; }
        public int ? Users_Id { get; set; }
        public int ? Flag { get; set; }
    }
}